<template>
  <!-- 任务管理  -->
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
      <el-form-item label="名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入名称"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
      </el-form-item>
    </el-form>
    <el-row>
      <el-col :span="24">
        <el-button
          type="primary" 
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
        >新增
        </el-button>
      </el-col>
      <el-col :span="24">

        <el-table :data="noticeList"   :header-cell-style="{ background: '#F3F5FC' }" >

        

          <el-table-column label="序号" align="center" width="100">
            <template slot-scope="scope">
              {{ scope.$index + 1 }}
            </template>
          </el-table-column>
          <el-table-column
            label="名称"
            prop="name"
            :show-overflow-tooltip="true"
          />
          <el-table-column label="源格式"  prop="sourceFormatName"/>
          <el-table-column label="目标格式"  prop="purposeFormatName"/>
              <el-table-column label="描述"  prop="description"/>
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                   @click="handleUpdate(scope.row)"
              >编辑
              </el-button>
              <el-button
                size="mini"
                type="text"
             @click="handleDelete(scope.row)"
              >删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </el-col>
    </el-row>
    <!-- 添加或修改对话框 -->

 <time-dia  ref="editRef"></time-dia>
  </div>
</template>

<script>
import taskListData from '../mockData/timeConver.json'
import editDialog from '@/components/accessProduct/taskList/emitDialog.vue'
import TimeDia from '../../../components/Dialogs/TimeDia.vue'


export default {
  name: 'taskList',
  components:{editDialog,taskListData,TimeDia,},
  data() {
    return {
      noticeList: [],
      queryParams: {
        name: '',
        pageNum: 0,
        pageSize: 20
      },
      formData:{},
      total: 0
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.total = taskListData.page.totalCount
      this.noticeList = taskListData.page.list
      console.log( taskListData);
    },
    // 新增
    handleAdd() {
      this.$refs.editRef.open=true;
      this.$refs.editRef.active=0;
      this.title='添加'

    },
    // 查询
    handleQuery() {

    },
    // 编辑
    handleUpdate() {
      this.$refs.editRef.open=true;
      this.$refs.editRef.active=0;
      this.title='编辑'
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const name = row.taskName
      this.$modal.confirm('是否确认删除"' + name + '"的数据项？').then(function() {
        return true
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('删除成功')
      }).catch(() => {
      })
    },
  }
}
</script>

<style lang="scss" scoped>
.box {
  padding: 2px 5px;
  margin-right:5px;
  backgorund: #f2f2f2;
  border: 1px solid #d9d9d9;
  border-radius:4px;
}
</style>
